package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CheckItemDao {
    /*新增检查项*/
    @Insert("insert into t_checkitem(code, name, sex, age, price, type, remark, attention)" +
            " VALUES" +
            " (#{code}, #{name}, #{sex}, #{age}, #{price}, #{type}, #{remark}, #{attention})")
    void add(CheckItem checkItem);
    /*分页查询*/
    Page<CheckItem> pageQuery(QueryPageBean queryPageBean);
    /*根据id查询*/
    @Select("select * from t_checkitem where id=#{id}")
    CheckItem findById(Long id);
    /*根据id删除*/
    @Delete("delete from t_checkitem where id=#{id}")
    void delete(Long id);
    /*修改检查项*/
    void edit(CheckItem checkItem);
    /*查询所有检查项*/
    @Select("select * from t_checkitem")
    List<CheckItem> findAll();
    /*根据检查组id查询检查项id*/
    List<String> findCheckItemIdsByCheckGroupId(Long checkgroupId);
}
